//****************************contacts module*********************************
function addParametersToUrl(url){
	var filterBy = document.getElementById("filterBy");
	var searchFor = document.getElementById("searchFor");
	if(filterBy&&searchFor){
		if(url.indexOf("?")==-1)
            window.location.href=url+"?filterBy="+filterBy.value+"&searchFor="+searchFor.value;
		else
			window.location.href=url+"&filterBy="+filterBy.value+"&searchFor="+searchFor.value;
		
		
	}
		
	
}

//common cancel functions

function cancel(url){
var action=url;
document.forms[0].action=action;
document.forms[0].submit();

}

function cancelform(form,url){
var action=url;
var formname=form;
document.forms[formname].action=action;
document.forms[formname].submit();
}



//Company_Contacts
function uploadContacts() {
document.forms[0].action="Contact_displayUploadCCL.action";
document.forms[0].submit();
}

//Company_ContAdd
	//cancel('./viewCorporateContacts.do')

//Company_ContDelete
	//cancel('./viewCorporateContacts.do')
function fnAddToForm() 
{
	document.forms['contactForm'].elements["phonenumber"].value = document.forms['contactForm'].elements["phonenumber"].defaultValue;
	document.forms['contactForm'].elements["alias"].value = document.forms['contactForm'].elements["alias"].defaultValue;
	document.forms['contactForm'].elements["firstName"].value = document.forms['contactForm'].elements["firstName"].defaultValue;
	document.forms['contactForm'].elements["lastName"].value = document.forms['contactForm'].elements["lastName"].defaultValue;
}

//Company_ContEdit
	//cancel('./viewCorporateContacts.do')
function fnSave() 
{
	if(!document.forms['contactForm'].elements["previousphoneNumber"].value){
		document.forms['contactForm'].elements["previousphoneNumber"].value=document.forms['contactForm'].elements["phonenumber"].defaultValue;
	}
}

//Company_UploadCont
	//cancel('./viewCorporateContacts.do')

//Personal_ContAdd
	//cancel('./viewPersonalContacts.do')

//Personal_ContDelete
	//cancel('./viewPersonalContacts.do')
function fnPersonalAddToForm() 
{
	document.forms['contactForm'].elements["phonenumber"].value = document.forms['contactForm'].elements["phonenumber"].defaultValue;
	document.forms['contactForm'].elements["alias"].value = document.forms['contactForm'].elements["alias"].defaultValue;
	document.forms['contactForm'].elements["firstName"].value = document.forms['contactForm'].elements["firstName"].defaultValue;
	document.forms['contactForm'].elements["category"].value = document.forms['contactForm'].elements["category"].defaultValue;
	document.forms['contactForm'].elements["lastName"].value = document.forms['contactForm'].elements["lastName"].defaultValue;
}

//Personal_ContEdit
	//cancel('./viewPersonalContacts.do')
function fnPersonalSave() 
{
	if(!document.forms['contactForm'].elements["previousphoneNumber"].value){
	document.forms['contactForm'].elements["previousphoneNumber"].value = document.forms['contactForm'].elements["phonenumber"].defaultValue;
	}
}

function uploadPersonalContacts() {
	document.forms[0].action="Contact_displayUploadPCL.action";
	document.forms[0].submit();
}
